package controllers;


import java.util.List;

import models.Banner;
import models.Link;

import com.et.mvc.Controller;
import com.et.mvc.binding.DataBinders;
import com.et.mvc.filter.BeforeFilter;
import com.et.mvc.filter.BeforeFilters;

@BeforeFilters( { @BeforeFilter(execute = "pageInit") })
public class PortalController extends Controller {
	static {
		DataBinders.setAllowEmpty(true);
	}
	
	protected boolean pageInit() throws Exception {
		List<Banner> lists = Banner.findAll(Banner.class," status =  1 ",null,"sort");
		request.setAttribute("lists", lists);
		
		List<Link> items = Link.findAll(Link.class," totop = 1 ",null,"sort");
		for (int i = items.size(); i < 32; i++) {
			Link item = new Link();
			items.add(item);
		}
		request.setAttribute("items", items);
		return true;
	}
}
